
	var packetCommand = function() {
		this.command = -1;
		this.id = "";
		this.name = "";
		this.param = {};
	};
	
	
	
	var taskParam = function() {
		this.cmd = "";
		this.managerID = "";
		this.taskID = "";
	};
	
	
	var channelParam = function() {
		this.cmd = "";
		this.channel = {};
	};
	
	
	var deviceParam = function() {
		this.cmd = "";
		this.channel_id = -1;
		this.type = "";
		this.device = {};
	};
	
	var tagParam = function() {
		this.cmd = "";
		this.device_id = -1;
		this.tag = {};
	};
	
	
	var sysConfigParam  = function() {
		this.cmd= "";
		this.config = {};
	
	};
	
	
	var serverConfigParam = function() {
		serverConfigParam.cmd = "";
		serverConfigParam.config = {};
	
	};
	
	
	var userParam = function() {
		this.cmd = "";
		this.user = {};
	
	};
	
	
	var Channel = function() {
		this.id = -1;
		this.name = "";
		this.desc = "";
		this.type = "";
		this.address = "";
		this.user ="";
		this.password ="";
		this.read = "";
		this.write ="";
	};
	
	
	
	var Device = function() {
		this.id = -1;
		this.channel_id = -1;
		this.name = "";
		this.desc = "";
		this.slave_id = 1;
		this.port = "";
		this.baudrate = 0;
		this.bytesize = 0;
		this.stopbits = 0;
		this.parity = "";
		this.timeout = 5;
		this.type = "";
		this.address = "";
	};
	
	
	var Tag = function() {
		this.id = -1;
		this.channel_id = -1;
		this.device_id = -1;
		this.name = "";
		this.desc = "";
		this.func_code = "";
		this.address = 0;
		this.length = 1;
		this.duration = -1;
		this.swaptype = "";
		this.last_read = "";
	
	};
	
	
	var SystemConfig = function() {
		this.ip = "";
		this.name = "";
		this.mask = "";
		this.gateway = "";
		this.dns1 = "";
		this.dns2 = "";
	
	};
	
	
	var ServerConfig = function(){
		this.http = "";
		this.sleep = -1;
		this.clean_log = -1;
		this.max_log = -1;
		this.max_packet = -1;
		this.session_expire = -1;
		this.max_upload = -1;
		this.mqtt_tls = -1;
	};
	
	
	
	var User = function(){
		this.id = "";
		this.ori_name = "";
		this.name = "";
		this.password = "";
		this.phone = "";
	
	};
	
	var Log = function(){
	
		this.type = "";
		this.time = "";
		this.content = "";
	};
	
	
	
	
	
	
	
	
	
	
	
	const (
	  CmdTaskManager   = iota // 0 任务管理
	  CmdRuntimeInfo          // 1 任务运行情况
	  CmdSystemInfo           // 2 系统情况
	  CmdSystemConfig         // 3 系统设置
	  CmdServerConfig         // 4 服务设置
	  CmdChannel              // 5 Channel管理
	  CmdDevice               // 6 设备管理
	  CmdTag                  // 7 点管理
	  CmdRestartSystem        // 8 重启系统
	  CmdRestartServer        // 9 重启服务
	  CmdUser                 // 10 用户
	  CmdLogin                // 11 登陆
	  CmdLog                  // 12 log
	)




//	function WebSocketTest()
//       {
//          if ("WebSocket" in window)
//          {
//             alert("您的浏览器支持 WebSocket!");
//             
//             // 打开一个 web socket
//             var ws = new WebSocket("ws://localhost/ws");
//              
//             ws.onopen = function()
//             {
//                // Web Socket 已连接上，使用 send() 方法发送数据
////                var json = JSON.stringify(Command);
////                ws.send(json);
//                alert("数据发送中...");
//             };
//              
//             ws.onmessage = function (evt) 
//             { 
//                var received_msg = evt.data;
//                alert("数据已接收...");
//             };
//              
//             ws.onclose = function()
//             { 
//                // 关闭 websocket
//                alert("连接已关闭..."); 
//             };
//          }
//          
//          else
//          {
//             // 浏览器不支持 WebSocket
//             alert("您的浏览器不支持 WebSocket!");
//          }
//       }
//       WebSocketTest();
